home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / WordUp.dxr / UI elements_8_scroll slider.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  1.4 KB  |  66 lines

  1. property pSprite, spriteNum, pbar, pLine, pGo, ppos, ptext, ptotal
  2.  
  3. on getPropertyDescriptionList me
  4.   return [#pbar: [#comment: " ", #format: #integer, #default: 0], #ptext: [#comment: " ", #format: #string, #default: "ass"]]
  5. end
  6.  
  7. on beginSprite me
  8.   pSprite = sprite(spriteNum)
  9.   pLine = sprite(pbar)
  10.   pSprite.loc = pLine.pTop
  11.   ppos = 0
  12.   pGo = 0
  13.   if spriteNum = 23 then
  14.     ptotal = 527
  15.   else
  16.     ptotal = 583
  17.   end if
  18. end
  19.  
  20. on mouseDown me
  21.   pGo = 1
  22. end
  23.  
  24. on mouseUp me
  25.   pGo = 0
  26. end
  27.  
  28. on mouseUpOutSide me
  29.   mouseUp(me)
  30. end
  31.  
  32. on positio me
  33.   barl = pLine.pBottom - pLine.pTop
  34.   percent = (pSprite.locV - pLine.pTop) * 100.0 / barl
  35.   total = ptotal
  36.   newscroll = percent * total / 100.0
  37.   member(ptext).scrollTop = newscroll
  38. end
  39.  
  40. on slide me
  41.   ww = ptotal
  42.   ss = member(ptext).scrollTop.float * 100.0 / ww.float
  43.   bart = pLine.pBottom - pLine.pTop
  44.   asd = bart * ss / 100.0
  45.   pSprite.locV = pLine.pTop + asd
  46. end
  47.  
  48. on exitFrame me
  49.   if pGo then
  50.     pSprite.locH = pLine.locH
  51.     pSprite.locV = the mouseV
  52.     if pSprite.locV < pLine.pTop then
  53.       pSprite.locV = pLine.pTop
  54.     else
  55.       if pSprite.locV > pLine.pBottom then
  56.         pSprite.locV = pLine.pBottom
  57.       end if
  58.     end if
  59.     barl = pLine.pBottom - pLine.pTop
  60.     percent = (pSprite.locV - pLine.pTop) * 100.0 / barl
  61.     total = ptotal
  62.     newscroll = percent * total / 100.0
  63.     member(ptext).scrollTop = newscroll
  64.   end if
  65. end
  66.